<?php

/**
 * @Author: Wang chunsheng  email:2192138785@qq.com
 * @Date:   2023-04-22 13:26:52
 * @Last Modified by:   Wang chunsheng  email:2192138785@qq.com
 * @Last Modified time: 2023-05-02 23:10:15
 */

/**
 * @authors Radish (minradish@163.com)
 * @date    2022-08-27
 */

namespace Common\Models;

use Common\BaseModel;

/**
 * This is the model class for table "{{%diandi_smart_socket_device}}".
 *
 * @property int      $id          ID
 * @property int      $bloc_id     企业ID
 * @property int      $store_id    商户ID
 * @property int      $relation_id 关联ID
 * @property string   $module      关联模块
 * @property string   $name        设备名称
 * @property resource $identify    设备标识
 * @property string   $state       设备通电状态
 * @property int      $status      状态
 * @property string   $created_at  创建时间
 * @property string   $updated_at  更新时间
 */
class Member extends BaseModel
{
   protected ?string $table = 'member';

    protected array $fillable = [
        'group_id',
        'project_id',
        'level',
        'openid',
        'store_id',
        'bloc_id',
        'username',
        'mobile',
        'address',
        'nickName',
        'avatarUrl',
        'gender',
        'country',
        'province',
        'status',
        'city',
        'address_id',
        'invitation_code',
        'verification_token',
        'create_time',
        'update_time',
        'auth_key',
        'password_hash',
        'password_reset_token',
        'realname',
        'avatar',
        'qq',
        'vip',
        'birthyear',
        'constellation',
        'zodiac',
        'telephone',
        'idcard',
        'studentid',
        'grade',
        'zipcode',
        'nationality',
        'resideprovince',
        'graduateschool',
        'company',
        'education',
        'occupation',
        'position',
        'revenue',
        'affectivestatus',
        'lookingfor',
        'bloodtype',
        'height',
        'weight',
        'alipay',
        'msn',
        'email',
        'taobao',
        'site',
        'bio',
        'interest',
        'organization_id',
        'member_code'
    ];


    public function getAccessToken(): \Hyperf\Database\Model\Relations\HasOne
    {
        return $this->hasOne(ApiAccessToken::class, null, 'member_id', 'member_id')->select('refresh_token', 'access_token', 'member_id');
    }

    /**
     * {}
     */
    public function attributeLabels(): array
    {
        return [
            'member_id' => '用户id',
            'openid' => 'OpenID',
            'nickName' => '昵称',
            'group_id' => '用户组id',
            'avatarUrl' => '头像',
            'gender' => '性别',
            'country' => '国家',
            'province' => '省份',
            'city' => '城市',
            'address_id' => '地址',
            'invitation_code' => '邀请码',
            'access_token' => 'Access Token',
            'verification_token' => '验证token',
            'create_time' => '创建时间',
            'update_time' => '更新时间',
        ];
    }
}
